<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use App\Console\Commands\IEC104Cmd;
use App\Console\Commands\NariDataReportCmd;
use App\Console\Commands\GrabGarbageCmd;
use App\Console\Commands\GrabGarbageReportCmd;
use App\Console\Commands\DcsDataCmd;
use App\Console\Commands\DcsDataReportCmd;
use App\Console\Commands\AvsDataCmd;
use App\Console\Commands\AvsDataReportCmd;
use App\Console\Commands\RegionDataCommand;
use App\Console\Commands\SourceDataCmd;
use App\Console\Commands\MaterialCmd;
use App\Console\Commands\MaterialCategory;
use App\Console\Commands\InboundCmd;
use App\Console\Commands\InboundDetailCmd;
use App\Console\Commands\SyncBasic;
use App\Console\Commands\SyncSupplier;
use App\Console\Commands\SyncCheck;

class Kernel extends ConsoleKernel
{
    protected $commands = [
        IEC104Cmd::class,
        NariDataReportCmd::class,
        GrabGarbageCmd::class,
        GrabGarbageReportCmd::class,
        DcsDataCmd::class,
        DcsDataReportCmd::class,
        AvsDataCmd::class,
        AvsDataReportCmd::class,
        RegionDataCommand::class,
        SourceDataCmd::class,
        MaterialCmd::class,
        MaterialCategory::class,
        InboundCmd::class,
        InboundDetailCmd::class,
        SyncBasic::class,
        SyncSupplier::class,
        SyncCheck::class
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        $schedule->command('collect:iec104')->everyFiveMinutes();
        $schedule->command('collect:grabGarbage')->everyFiveMinutes(); 
        $schedule->command('naridata:report')->everyMinute();
        $schedule->command('grabgarbage:report')->everyMinute();
        //$schedule->command('collect:dcsData')->everyFiveMinutes();
        $schedule->command('dcsdata:report')->everyMinute();
        $schedule->command('collect:avsdata')->everyFiveMinutes();
        $schedule->command('avsdata:report')->everyMinute();
        $schedule->command('collect:regionDataCmd')->dailyAt("8");
        $schedule->command('collect:regionDataCmd')->dailyAt("12");
        $schedule->command('collect:regionDataCmd')->dailyAt("18");
        $schedule->command('collect:sourceData')->dailyAt("8");
        $schedule->command('collect:sourceData')->dailyAt("12");
        $schedule->command('collect:sourceData')->dailyAt("18");
        $schedule->command('collect:materialCategory')->cron('3,43 4 * * *'); //4:03  12:43
        $schedule->command('collect:materialCategory')->cron('33 12 * * *');  //12:33 
        $schedule->command('collect:materialCategory')->cron('13 13 * * *');  //13:13
        $schedule->command('collect:material')->cron('7,47 4 * * *'); 
        $schedule->command('collect:material')->cron('37 12 * * *'); 
        $schedule->command('collect:material')->cron('17 13 * * *');
        $schedule->command('collect:syncBasic')->cron('9 4 * * *'); 
        $schedule->command('collect:syncBasic')->cron('39 12 * * *'); 
        $schedule->command('collect:syncSupplier')->cron('12 4 * * *');
        $schedule->command('collect:syncSupplier')->cron('42 12 * * *');
        $schedule->command('collect:inboundDetail')->cron('16,56 4 * * *'); 
        $schedule->command('collect:inboundDetail')->cron('46 12 * * *'); 
        $schedule->command('collect:inboundDetail')->cron('26 13 * * *'); 
        $schedule->command('collect:inbound')->cron('19,58 4 * * *'); 
        $schedule->command('collect:inbound')->cron('49 12 * * *'); 
        $schedule->command('collect:inbound')->cron('29 13 * * *'); 
        $schedule->command('collect:syncCheck')->dailyAt("6");
        $schedule->command('collect:syncCheck')->dailyAt("14");
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}
